<?php

		/*** MOBILE NOTIFICATION (experimental) ***
		* mobile_notify.php
		* Author: David Reilly
		*
		* before you invoke the script, you will need:
				a running instance of PinSQL
				a $message variable
				a $subject
				an $id variable with the 'id' field of the recipient
		***/
		
		$pinSQL->Query("SELECT * FROM memberdata WHERE id='$id'");
		$row = $pinSQL->FetchNextRow();
		$cellnotify = $row['cellnotify'];

		if ($cellnotify)
		{

		$carrier = $row['carrier'];
		$phonenum = $row['phone'];
		
		$headers = 'From: notify@pinproject.com' . "\r\n" .
			'Reply-To: notify@pinproject.com' . "\r\n" .
		    'X-Mailer: PHP/' . phpversion();

			switch ($carrier)
			{
				case "att":
					$to = "$phonenum@txt.att.net";
					break;
					
				case "Verizon":
					$to = "$phonenum@vtext.com";
					break;
					
				case "T-Mobile":
					$to = "$phonenum@tmomail.net";
					break;
					
				case "Sprint":
					$to = "$phonenum@messaging.sprintpcs.com";
					break;
					
				case "Nextel":
					$to = "$phonenum@messaging.nextel.com";
					break;
			}

			$messageStripped = stripslashes($message);
					
			error_reporting(0);
			
			mail($to, $subject, $messageStripped, $headers);
				
			error_reporting(1);
		}
		//_______________________
		
?>